package com.yiqi.lottery.feature.documentary.view.adapter;

import android.support.annotation.Nullable;

import android.text.TextUtils;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suozhang.framework.framework.AM;
import com.yiqi.lottery.R;
import com.yiqi.lottery.common.util.DateTool;
import com.yiqi.lottery.entity.bo.DocumentaryBo;
import com.yiqi.lottery.entity.bo.HallBo;

import javax.inject.Inject;

import java.util.List;

public class DocumentaryAdapter extends BaseQuickAdapter<HallBo, BaseViewHolder> {
    public DocumentaryAdapter() {
        super(R.layout.item_documentary_list);
    }

    @Override
    protected void convert(BaseViewHolder helper, HallBo item) {
        helper.setText(R.id.tv_documentary_name, item.getUser_info().getUsername())
                .setText(R.id.tv_documentary_deadline, "截至" + DateTool.TimeStamp2Date10((item.getFinish_time())))
                .setText(R.id.tv_documentary_amount, item.getOrder_amount() + "")
                .setText(R.id.tv_documentary_type, TextUtils.isEmpty(item.getUser_rank_info().getSeven_record_amount()) ? "" :   item.getUser_rank_info().getSeven_record_amount())
                .setText(R.id.iv_documentary_person_renshu, item.getFollow_num() + "")
                .setText(R.id.tv_documentary_lottotype, item.getBet_label() + "")
                .setText(R.id.tv_documentary_chuan, item.getPass_type())
                .setText(R.id.tv_min_amount, item.getMin_amount() + "")

                .setText(R.id.tv_documentary_lian, item.getUser_rank_info().getContinus() + "连红")
                .setText(R.id.tv_xuanyan, TextUtils.isEmpty(item.getFollow_intro()) ? "暂无方案宣言" : item.getFollow_intro())
                .addOnClickListener(R.id.btn_documentary_again)
                .addOnClickListener(R.id.btn_to_personalinfo);
        AM.image().bindToCircleObject(item.getUser_info().getAvatar(), helper.getView(R.id.iv_documentary_person_head));
        helper.getView(R.id.tv_documentary_lian).setVisibility(item.getUser_rank_info().getContinus() > 0 ? View.VISIBLE : View.GONE);
    }
}
